#!/bin/bash
cd /home/judge/git
git pull

while ! svn up /home/judge/src
do
  echo "Subversion update from github.com failed , retry in 5 seconds ..."
  sleep 5s
done

cd /home/judge/src/core
pkill -9 judged
bash make.sh
cd ../install
chmod +x g++.sh gcc.sh makeout.sh
mysql jol< update.sql
judged

web_user=`grep www /etc/passwd|awk -F: '{print $1}'`
mkdir /var/log/hustoj/
chown -R $web_user /var/log/hustoj

chmod 770 /home/judge/src/web/upload
chown $web_user -R /home/judge/src/web/upload

